#!/usr/bin/env python
#--coding:utf-8--
import sys
import os

sys.path.append(os.path.dirname(os.path.abspath(__file__)))

import logging

class logCls:
    def __init__(self,filename,level="info"):
        level=level.upper()
        logging.basicConfig(filename=filename,
                            filemode="w",
                            format="%(asctime)s,%(levelname)s,%(name)s,%(funcName)s,%(pathname)s,%(filename)s,%(message)s",
                            datefmt="%Y-%m-%d %H:%M:%S",
                            level=getattr(logging,level))
    def infile(self,string,level="info"):
        level = level.lower()
        getattr(logging,level)(string)

